//
//  XDLMMiiddleWebViewController.m
//  xindailianmeng
//
//  Created by xu on 17/3/18.
//  Copyright © 2017年 xindailianmeng.cn. All rights reserved.
//

#import "XDLMMiiddleWebViewController.h"
#import "XDLMGoodPlanViewController.h"

@interface XDLMMiiddleWebViewController ()

@property (nonatomic , strong)UIWebView                 *webView;

@end

@implementation XDLMMiiddleWebViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationController.navigationBarHidden = NO;

    [self buildLayout];
    // Do any additional setup after loading the view.
}

- (void)buildLayout{
    [self.view addSubview:self.webView];
    self.title = self.titleStr;
    
    UIButton *btn = [[UIButton alloc]initWithFrame:CGRectMake(0, 0, kScreenW, 100)];
    btn.backgroundColor = [UIColor orangeColor];
    [btn addTarget:self action:@selector(btnpress) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:btn];
}

-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];

}

- (void)btnpress{
    XDLMGoodPlanViewController *good = [[XDLMGoodPlanViewController alloc]init];
    [self.navigationController pushViewController:good animated:YES];
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


#pragma mark - lazy

-(UIWebView *)webView{
    if (_webView == nil) {
        _webView = [[UIWebView alloc]initWithFrame:CGRectMake(0, 0, kScreenW, kScreenH - 64)];
        NSURL *requsetUrl = [NSURL URLWithString:KWebUrl(self.splitStr)];
        NSURLRequest *loadurl = [NSURLRequest requestWithURL:requsetUrl];
        [_webView loadRequest:loadurl];
    }
    return _webView;
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
